<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }
        .box {
            margin-left: 200px;
            width: 80px;
        }
        li {
            list-style: none;
            width: 80px;
            height: 25px;
            border: 1px solid #ebbe7a;
            border-top: 0;
            text-align: center;
            display: none;
            cursor: pointer;
            line-height: 25px;
            font-size: 14px;
            color: #4c4c4c;
        }

        li:first-child{
            height: 30px;
            display: block;
        }
        li:hover {
            background-color: lightcyan;
            color: #f3970d;
        }
    </style>
</head>
<body>
    <div class="box">
        <ul>
            <li class="first">微博</li>
            <li>私信</li>
            <li>评论</li>
            <li>@我</li>
        </ul>
    </div>

    <script>
        var box = document.querySelector('.box')
        var fir = document.querySelector('.first');
        var li = document.querySelectorAll('.box li');

        box.onmouseover = function (){
            // li.style.display = 'block';
            for (var i = 0; i < li.length; i++){
                //li[i]
                
                
                if(i == 0){
                    li[i].style.backgroundColor = '#cccccc';
                    li[i].style.color = 'red';
               }else {
                    li[i].style.display = 'block';
               }
            }
        }
        box.onmouseout = function (){
            for (var i = 0; i < li.length; i++){
                //li[i]
               if(i == 0){
                    li[i].style.backgroundColor = '#fff';
                    li[i].style.color = '#4c4c4c';
               }else {
                    li[i].style.display = 'none';
               }
            }
        }
    </script>
</body>
</html>